<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="js/vue.js"></script>
    <title>Document</title>
    <style>
        .list{
            height: 400px;
            background-color: aqua;
            
        }
        li{
            height: 200px;
        }
    </style>
</head>
<body>
    <!-- 

        Vue中的事件修饰符:
            1.prevent:阻止默认事件 (常用) ;
            2.stop: 阻止事件冒泡(常用) ;
            3.once:事件只触发一次 (常用) :
            4.capture:使用事件的捕获模式;
            5.self: 只有event.target是当前操作的元素时才触发事件;
            6.passive:事件的默认行为立即执行，无需等待事件回调执行完毕:

     -->
    <div id="root">
        <h2>欢迎来到{{name}}学习</h2>
        <button v-on:click="showInfo1">点我提示信息1(不传参数)</button>
        <a href="https://www.baidu.com" @click.prevent="showInfo2(66,$event)">点我提示信息2(传参数)</a>
        <div @click="showInfo2">
            <button @click.stop="showInfo1"></button>
        </div>
        <div @click.self="showMsg(1)">
            1231234789856
            <div @click="showMsg(2)">
                13213
            </div>
        </div>
        <ul @scroll="demo" class="list">
            <li>1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
        </ul>
    </div>
    <script>
        Vue.config.productionTip = false;
        const vm = new Vue({
            el:'#root',
            data:{
                name:'千锋'
            },
            methods:{
                showInfo1(event){
                    // console.log(event.target.innerText);
                    // console.log(this);  此处的this是vm
                    alert('同学你好！')
                },

                showInfo2(number,event){
                    console.log(event.target.innerText);
                    // console.log(this);  此处的this是vm
                    console.log(number);
                    alert('同学你好!!')
                }
                ,
                showMsg(number){
                    console.log(number);
                },
                demo(){
                    console.log('@');
                }
            }
        })
    </script>
</body>
</html>